from aiogram import Bot

from dc_shop.config import Settings
from dc_shop.database.services import BotSettingsService
from dc_shop.tg_bot.services.tg_helpers import send_tg_message
from dc_shop.worker.exception_handler import exception_handler


@exception_handler
async def auto_enable_bot(
    ctx,
) -> None:
    bot: Bot = ctx["bot"]
    config: Settings = ctx["config"]
    bot_settings_service: BotSettingsService = ctx["bot_settings_service"]

    await bot_settings_service.update_bot_status(True)

    await send_tg_message(bot, config.tg_bot.admin_channel_id, "Бот был автоматически включен")
